import request from '@/helper/request'

/**
 * @description 查询无人机设备
 * @param page 页码 从0开始
 * @return {AxiosPromise}
 */
export function getQueryList({page, name, size, userCode}) {
	return request({
		url: '/api/drone',
		method: 'get',
		params: {
			page,
			name,
			size,
			userCode
		}
	})
}

/**
 * @description 新增无人机设备
 * @param id
 * @param model
 * @param name
 * @param productSn
 * @param remoteSn
 * @return {AxiosPromise}
 */
export function addDeviceInfo({id, model, name, productSn, remoteSn}) {
	return request({
		url: '/api/drone',
		method: 'post',
		data: {
			id,
			model,
			name,
			productSn,
			remoteSn
		}
	})
}

/**
 * @description 编辑无人机设备
 * @param id
 * @param model
 * @param name
 * @param productSn
 * @param remoteSn
 * @return {AxiosPromise}
 */
export function editDeviceInfo({id, model, name, productSn, remoteSn, userCode}) {
	return request({
		url: '/api/drone',
		method: 'put',
		data: {
			id,
			model,
			name,
			productSn,
			remoteSn,
			userCode
		}
	})
}

/**
 * @description 查询设备详情
 * @return {AxiosPromise}
 */
export function getDeviceDetailInfo({id}) {
	return request({
		url: '/api/drone/getOne',
		method: 'get',
		params: {
			id
		}
	})
}

/**
 * @description 删除设备编号
 */
export function deleteDeviceById({id}) {
	return request({
		url: '/api/drone',
		method: 'delete',
		data: [id]
	})
}

/**
 * @description 获取设备列表
 * @return {AxiosPromise}
 */
export function getDeviceModelList() {
	return request({
		url: '/api/dictDetail/getAllByName',
		method: 'get',
		params: {
			dictName: 'drone_model',
			// userCode: '140000',
			// size: 10,
			// page: 1
		}
	})
}
